package markgame2dphys;

import java.awt.Color;

import net.phys2d.math.Vector2f;
import net.phys2d.raw.shapes.Polygon;

public class MarkGamePolygon extends MarkGameObject{

	public Polygon polygon = null;
	public Vector2f[] points;

	/**
	 * os pontos devem ser em torno do centro de massa
	 * caso contrario o centro de massa sera deslocado do centro de massa
	 * @param points
	 * @param mass
	 */
	public MarkGamePolygon(Vector2f[] points, float mass) {
		super(new Polygon(points), mass);
		this.points = points;
		polygon = (Polygon)body.getShape();
	}

	@Override
	public void paint(MarkGameGraphics g) {
		g.setColor(Color.BLACK);

		g.pushTransform();{
			
			g.rotate(body.getRotation(), body.getPosition());
			
			g.translate(body.getPosition());
			
			g.drawPolygon(points);
			
			int radius = 2;
			g.drawCircle(new Vector2f(0,0), radius);
			
		}g.popTransform();
	}

}
